﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using HRM.Model;
using System.Windows;

namespace HRM.Converter
{
    public class ConvertFunctionToVisible : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {

            if ((string)parameter == "t") return Visibility.Visible;
            if (parameter == null || value == null) return Visibility.Collapsed;
            int functionID = System.Convert.ToInt32(parameter);
            ChucNang cn = (ChucNang)value;
            if (cn.MaChucNang == functionID) return Visibility.Visible;
            else return Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
